<html>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-6707232-7']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
<script language="javascript">
function statusform(value)
{
 document.fee.applyforfee.value = value;
 document.fee.submit();
}

function populatedata(std, year, feetype, amount)
{
 document.fee.Std.value = std;
 document.fee.Year.value = year;
 document.fee.FeeType.value = feetype;
 document.fee.Amount.value = amount;
}

function populatename(name)
{
 document.fee.Name.value = name;
}

function clearform()
{
 document.fee.RegNo.value = '';
 document.fee.Name.value = '';
 document.fee.Std.value = '';
 document.fee.Year.value = '';
 document.fee.FeeType.value = '';
 document.fee.Amount.value = '';
 document.fee.ChequeNo.value = '';
 document.fee.Bank.value = '';
}

function printreceipt(receiptno)
{
 document.printform.receiptno.value = receiptno;
 document.printform.submit();
}

</script>
<body onLoad="populatename('{{student.FirstName}} {{student.LastName}}')">
<div align="center">

<h2>
Jnana Prabodhini Prashala<br/>
510, Sadashiv Peth, Pune - 30<br/>
</h2><br/>
<div name="receiptnum" style="position:absolute;right:200;top:100">
<table>
<tr> <td><b>Date</b></td><td>{{date}}</td></tr>
<!--<tr> <td><b>Receipt Number</b></td><td>{{receiptnumber}}</td></tr>-->
</table>
</div>
<form name="fee" action="/fee/" method="post"> {% csrf_token %}

<!--
<table>
<tr><td> {{ form.RegNo.errors }} </td></tr>
<tr><td> {{ form.RegNo.label_tag }}:</td><td> {{ form.RegNo }}</td></tr>

<tr><td> {{ form.Student.errors }} </td></tr>
<tr><td> {{ form.Student.label_tag }}:</td><td> {{ form.Student }}</td></tr>
</table>
-->

<table>
{{ form.as_table }}
</table>
<br/><b>{{ message }}</b><br/><br/>
<input type="submit" value="Check Status" onClick="statusform(0)"/>
<input type="submit" value="Print Receipt" onClick="statusform(1)"/>
<input type="button" value="Clear Form" onClick="clearform()"/>
<input type="hidden" name="applyforfee" value="0"/>
</form>

</div>

<br/><br/>

<div>
<table align="center">
{% for row in years %}
<th>{{row.ClassMaster.AcademicYear}} / {{row.ClassMaster.Standard}}</th>
<th width="10">
</th>
{% endfor %}

<tr>
{% for row in years %}
<td align="center" valign="top">
<div id="{{row.ClassMaster.Standard}}" name="{{row.ClassMaster.Standard}}" align="top">
<table border="1" cellspacing="5" cellpadding="0">
{% for frow in row.FeeInfo %}
<tr><th colspan=2>{{frow.Type}}</th><th colspan=3>{{frow.Amount}}</th></tr>
{% for fda in frow.FeeDateAmount %}
<tr><td></td><td></td><td><a href="javascript:printreceipt({{fda.ReceiptNo}})">{{fda.ReceiptNo}}</a></td><td>{{fda.Date}}</td><td>{{fda.Amount}}</td></tr>
{% endfor %}
{% for sfee in frow.SpecialFee %}
<tr><td></td><td></td><td colspan=2>SpecialFee<td>{{sfee.Amount}}</td></tr>
{% endfor %}
{% for schol in frow.Scholarship %}
<tr><td></td><td></td><td colspan=2>Scholarship<td>{{schol.Amount}}</td></tr>
{% endfor %}
<tr><th colspan=2>Total Paid</th><th colspan=3>{{frow.Total}}</th></tr>
<tr><th colspan=2>Balance</th><th colspan=3><a href="javascript:populatedata('{{row.ClassMaster.Standard}}','{{row.ClassMaster.AcademicYear}}','{{frow.Type}}','{{frow.Balance}}')">{{frow.Balance}}</a></th></tr>
{% endfor %}

</table>
</div>
</td>
<td width="10">
</td>
{% endfor %}
</tr>
</table>
</div>

<form name="printform" action="/fee_receipt/" method="POST"> {% csrf_token %}
<input type="hidden" name="receiptno"/>
</form>

</body>
</html>
